package com.luyuan.gallery.service.impl;

import java.util.List;
import com.luyuan.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.luyuan.gallery.mapper.ExhiArtworkMapper;
import com.luyuan.gallery.domain.ExhiArtwork;
import com.luyuan.gallery.service.IExhiArtworkService;
import com.luyuan.gallery.vo.ExhiArtworkVO;

/**
 * 作品Service业务层处理
 * 
 * @author luyuan
 * @date 2025-11-13
 */
@Service
public class ExhiArtworkServiceImpl implements IExhiArtworkService {
    @Autowired
    private ExhiArtworkMapper exhiArtworkMapper;

    /**
     * 查询作品
     * 
     * @param artworkId 作品主键
     * @return 作品
     */
    @Override
    public ExhiArtwork selectExhiArtworkByArtworkId(Long artworkId) {
        return exhiArtworkMapper.selectExhiArtworkByArtworkId(artworkId);
    }

    /**
     * 查询作品列表
     * 
     * @param exhiArtwork 作品
     * @return 作品
     */
    @Override
    public List<ExhiArtworkVO> selectExhiArtworkList(ExhiArtwork exhiArtwork) {
        return exhiArtworkMapper.selectExhiArtworkList(exhiArtwork);
    }

    /**
     * 新增作品
     * 
     * @param exhiArtwork 作品
     * @return 结果
     */
    @Override
    public int insertExhiArtwork(ExhiArtwork exhiArtwork) {
        exhiArtwork.setCreateTime(DateUtils.getNowDate());
        return exhiArtworkMapper.insertExhiArtwork(exhiArtwork);
    }

    /**
     * 根据展厅ID查询作品列表
     * 
     * @param galleryId 展厅ID
     * @return 作品集合
     */
    @Override
    public List<ExhiArtworkVO> selectExhiArtworkListByGalleryId(Long galleryId) {
        return exhiArtworkMapper.selectExhiArtworkListByGalleryId(galleryId);
    }

    /**
     * 修改作品
     * 
     * @param exhiArtwork 作品
     * @return 结果
     */
    @Override
    public int updateExhiArtwork(ExhiArtwork exhiArtwork) {
        exhiArtwork.setUpdateTime(DateUtils.getNowDate());
        return exhiArtworkMapper.updateExhiArtwork(exhiArtwork);
    }

    /**
     * 批量删除作品
     * 
     * @param artworkIds 需要删除的作品主键
     * @return 结果
     */
    @Override
    public int deleteExhiArtworkByArtworkIds(Long[] artworkIds) {
        return exhiArtworkMapper.deleteExhiArtworkByArtworkIds(artworkIds);
    }

    /**
     * 删除作品信息
     * 
     * @param artworkId 作品主键
     * @return 结果
     */
    @Override
    public int deleteExhiArtworkByArtworkId(Long artworkId) {
        return exhiArtworkMapper.deleteExhiArtworkByArtworkId(artworkId);
    }
}
